package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pojo.dto.*;
import com.example.pojo.entity.Book;
import com.example.pojo.entity.Employee;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmployeeMapper extends BaseMapper<Employee> {
    /**
     * 新增职工
     *
     * @param employeeInsertDTO
     */
    void insertEmp(EmployeeInsertDTO employeeInsertDTO);

    /**
     * 删除职工
     *
     * @param id
     */
    @Delete("update tb_employee set `delete` = 0 where id=#{id};")
    void deleteEmp(Long id);

    /**
     * 修改员工信息
     */
    void updateEmp(EmployeeUpdateDTO employeeUpdateDTO);

    /**
     * 查询职工信息
     *
     * @param id
     * @return
     */
    @Select("select * from tb_employee where id=#{id};")
    Employee selectEmpById(Long id);

    /**
     * 查询所有职工信息
     *
     * @param EmployeePageDTO
     * @return
     */
    List<Employee> listByQuery(EmployeePageDTO EmployeePageDTO);

    /**
     * 根据账号查询职工信息
     *
     * @param username
     * @return
     */
    @Select("select * from tb_employee where account = #{account}")
    Employee getByAccount(String account);
}
